package cn.base.web.auth.inner.token;

import cn.rengy.auth.AuthenToken;
import cn.rengy.auth.TokenType;
import cn.rengy.auth.token.AbstractAuthenTokenCreator;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;

@Component
//@Order
public class InnerAuthenTokenCreator extends AbstractAuthenTokenCreator {


    public InnerAuthenTokenCreator() {
        super(TokenType.INNER);
    }

    @Override
    protected String getAuthorization(Object request) {
        HttpServletRequest _request=(HttpServletRequest)request;
        return _request.getHeader(HttpHeaders.AUTHORIZATION);
    }

    @Override
    protected AuthenToken createToken(String token, Object request){
        return new InnerAuthToken(token);
    }
}
